package cn.fz.learn02.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

@Data
@NoArgsConstructor
public class StudentDTO {
    @Schema(description = "姓名")
    @NotBlank(message = "用户名不能为空")
    private String name;

    @Schema(description = "账号")
    @NotBlank(message = "账号不能为空")
    private String account;

    @Schema(description = "密码")
    @NotBlank(message = "密码不能为空")
    @Length(min = 6, max = 20, message = "密码长度必须在6到20之间")
    private String password;

    @Schema(description = "联系方式")
    @Pattern(regexp = "^1[3-8]\\d{9}$", message = "手机号格式不正确")
    @NotBlank(message = "联系方式不能为空")
    private String phone;

    @Schema(description = "年龄")
    @Min(value = 0, message = "年龄必须大于0")
    @Max(value = 120, message = "年龄必须小于120")
    private Integer age;

    @Schema(description = "性别")
    private String gender;

    @TableField("stu_class")
    @Schema(description = "班级")
    private String stuClass;
}
